import request from '@/utils/request'

// 保存流程定义
export function createDeployment(name,xml,processDefinitionId){
  let data = {};
  data.definitionName = name;
  data.xml = xml;
  data.processDefinitionId = xml;
  return request({
    url:'/camunda/flow/processDefinition/createDeployment',
    method:'post',
    data: data
  });
}

// 获取流程定义列表
export function selProcessDefinitionList(query){
  return request({
    url: '/camunda/flow/processDefinition/selProcessDefinitionList',
    method: 'get',
    params: query
  })
}

// 获取流程bpmn xml
export function getBpmnModelXml(processDefinitionId){
  let query = {};
  query.processDefinitionId = processDefinitionId;
  return request({
    url: '/camunda/flow/processDefinition/getBpmnModelInstance',
    method: 'get',
    params: query
  })
}

// 查询
export function getMyProcessTask(query) {
  return request({
    url: '/camunda/flow/deployment/getMyProcessTask',
    method: 'get',
    params: query
  })
}

export function getBpmnModelInstance(processDefinitionId){
  let data = {};
  data.processDefinitionId = processDefinitionId;
  //console.log("JSON.stringify(data):"+ JSON.stringify(data))
  return request({
    url: '/camunda/flow/deployment/getBpmnModelInstance',
    method: 'post',
    data:  data
  })
}


export function getHighlightNode(processDefinitionId){
  let data = {};
  data.processDefinitionId = processDefinitionId;
  //console.log("JSON.stringify(data):"+ JSON.stringify(data))
  return request({
    url: '/flow/deployment/getHighlightNode',
    method: 'post',
    data:  data
  })
}
